﻿using System.Collections.Generic;
using com.guojin.core.io;
using com.guojin.core.io.message;

namespace com.guojin.mj.net.message.game
{
    public class 
        ChapterInfoRet : Message
    {
        public static int TYPE = 12;
        public static int ID = 9;

        public int state { get; set; }
        public List<UserChapterInfoRet> userChapterInfo { get; set; }
        public bool isJvGuo;                                //上局是否聚锅
        public int MaxLimitScore;
        public int currentSingleBet { get; set; }    //当前单注数（下注玩家的下注数）
        public int currentTotalBet { get; set; }      //当前总注数（带上局聚锅注数）
        public string totalBetScoreStr { get; set; }   //下注的字符串   
        public BetLocationIndexRet bir;
        public int[] winIndex { get; set; }

        public void decode(Input _in)
        {
            state = _in.readInt();
            if (state == 0)
                return;
            userChapterInfo = new List<UserChapterInfoRet>();
            userChapterInfo = _in.readList<UserChapterInfoRet>(_in);
            isJvGuo = _in.readBoolean();
            MaxLimitScore = _in.readInt();
            currentSingleBet = _in.readInt();
            currentTotalBet = _in.readInt();
            totalBetScoreStr = _in.readString();
            if (state == 1)
            {
                bir = new BetLocationIndexRet();
                bir.decode(_in);
            }
            else if (state == 2)
            {
                winIndex = _in.readIntArray();
            }          
        }

        public void encode(Output _out)
        {
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return string.Format("ChapterInfoRet[state={0}" , state);
        }
    }
}